package com.solo.system.model.i18n.type;

import com.solo.system.api.entity.SysI18nTypeData;
import com.solo.system.model.i18n.data.req.I18nTypeDataInfoReq;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 国际化语言类型数据关联实体转换类
 * @author 十一
 * @since 2024-10-25 14:19
 * 人生若只如初见，何事秋风悲画扇
 **/
@Mapper
public interface SysI18nTypeDataConvert {

    SysI18nTypeDataConvert INSTANCE = Mappers.getMapper(SysI18nTypeDataConvert.class);
    
    @Mapping(target = "dataId", source = "dataId")
    SysI18nTypeData convert(I18nTypeDataInfoReq bean, Long dataId);

    default List<SysI18nTypeData> convert(List<I18nTypeDataInfoReq> list, Long dataId) {
        return list.stream()
                .map(req -> convert(req, dataId))
                .toList();
    }
}
